<?php
/**
 * True Gallery back-end get image category template file
 *
 * @version 2.5
 * @author Alexey N. Brin (userxp@joomlaportal.ru)
 * @homepage http://truegallery.ru 
 * @filename admin.categories.catimg.tpl.php
 * @package True Gallery
 * @copyright (C) 2008-2010 by joomlatune.ru
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 * 
 * THIS GALLERY is an EVOLUTION of AkoGallery -> PonyGallery -> DatsoGallery
 *
 * If you fork this to create your own project, 
 * please make a reference to True Gallery someplace in your code 
 * and provide a link to http://www.joomlatune.ru
 *
 **/

defined('_VALID_MOS') or defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>
<div id="catimgblock">
	<h2><?php echo JText::_('TG_GET_CATIMG_TITLE'); ?></h2>
	<div id="catimgheader"><?php echo( $categories['catgs'] ); ?></div>
	<!--form action="<?php echo $this->_url('show'); ?>" method="post" name="catImgForm" -->
		<div id="catimgmanager"></div>
	<!--/form-->
	<div id="catimgfooter"></div>
</div>

<script type="text/javascript">
function getimgid(o) {
	var el = $j(o);
	returned_pic_id = el.attr('alt'); // global var returned_pic_id
	$j('#catimgfooter').html( 'Picture ID: ['+returned_pic_id+']');
} //getimgid

function reBindClick(){
	$j('#catimgmanager a').click(function(event){
		event.preventDefault();
		pic_id = $j(this).attr('alt');
		$j('#catimgfooter').html('Picture ID: ['+pic_id+']');
	}).dblclick(function(){
		returned_pic_id = $j(this).attr('alt');
		$j.fancybox.close(); //closes current fancybox
	});
} //reBindClick

// for category change selection
$j('select#cat').change(function(e){
	//jQuery.fancybox.showActivity();
	$j('#catimgmanager').load('<?php echo $this->_url('getCategoryPictures', true); ?>&catid='+$j(this).val(),
		function(responseText, textStatus, XMLHttpRequest){
			// on callback
			reBindClick();
		}
	);
});
$j('select#cat').change();
</script>